Defining functions and packages

# 1. Source functions ----

source("functions/graphical_par.R")
source("functions/theme_graph.R")
source("functions/pred_vbgf.R")

# 2. Required packages ----

library(tidyverse)
library(kableExtra)
library(formattable)
library(readxl)
library(plotly)
library(rfishbase)

# 3. Set theme_graph() as the default ggplot theme ----

theme_set(theme_graph())

# 4. Load data ----

data_complete <- read.csv("./../data/02_back-calculated-size-at-age_morat-et-al.csv")

1. Data exploration

1.1 Tables

1.1.1 Data with back-calc.

data_complete %>% 
  filter(!is.na(Li_sp_m)) %>% 
  summarize_at(vars("ID", "Species", "Family"), n_distinct, na.rm = TRUE) %>% 
  bind_rows(data_complete %>%
              summarize_at(vars("ID", "Species", "Family"), n_distinct, na.rm = TRUE), .) %>% 
  mutate(Type = c("All data", "Back-calculated"), .before = 1) %>% 
  kable(., 
        col.names = c("", "Individual", "Species", "Family"), 
        caption = "Table 1. Comparison of numbers of individuals, species and family for the overall dataset and for back-calculated data") %>% 
  kable_styling(bootstrap_options = c("striped", "hover"))
Table 1. Comparison of numbers of individuals, species and family for the overall dataset and for back-calculated data
Individual Species Family
All data 855 51 16
Back-calculated 710 45 16

1.1.2 Individual by species

data_complete %>%
  group_by(Species) %>% 
  summarise(n = length(unique(ID)),
        min_lencap = round(min(Lcpt, na.rm = TRUE), 0),
        max_lencap = round(max(Lcpt, na.rm = TRUE), 0),
        max_age = max(Agei, na.rm = TRUE)) %>% 
  kable(., 
        col.names = c("Species", "n", "Min length (TL, mm)", "Max length (TL, mm)", "Age max (years)"),
        caption = "Table 2. Number of individuals, minimum and maximum total length (mm) and maximum age, by species") %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  column_spec(1, italic = T)
Table 2. Number of individuals, minimum and maximum total length (mm) and maximum age, by species
Species n Min length (TL, mm) Max length (TL, mm) Age max (years)
Abudefduf sexfasciatus 16 51 172 13
Acanthurus achilles 17 130 246 27
Acanthurus lineatus 8 123 362 23
Acanthurus nigricans 8 150 210 9
Acanthurus pyroferus 18 51 230 19
Acanthurus triostegus 18 147 194 12
Balistapus undulatus 22 41 283 18
Caranx melampygus 7 368 712 15
Centropyge bispinosa 9 28 80 11
Centropyge flavissima 28 47 150 27
Cephalopholis argus 41 120 450 21
Cephalopholis urodeta 8 150 214 17
Chaetodon citrinellus 13 55 101 6
Chaetodon ornatissimus 10 122 175 10
Cheilinus chlorourus 8 96 299 6
Chlorurus spilurus 34 164 344 16
Chromis iomelas 20 39 61 5
Chromis viridis 6 115 148 9
Ctenochaetus marginatus 15 99 270 13
Ctenochaetus striatus 26 153 218 17
Dascyllus aruanus 20 51 71 7
Dascyllus flavicaudus 8 89 104 13
Epibulus insidiator 17 157 350 16
Epinephelus fasciatus 10 123 256 13
Epinephelus hexagonatus 16 139 268 14
Epinephelus merra 46 108 261 17
Epinephelus polyphekadion 14 252 514 20
Gnathodentex aureolineatus 8 197 255 17
Gymnosarda unicolor 4 499 985 7
Halichoeres trimaculatus 13 64 186 5
Lutjanus fulvus 12 195 289 21
Lutjanus gibbus 17 113 155 1
Lutjanus kasmira 37 70 326 30
Monotaxis grandoculis 9 200 505 20
Mulloidichthys flavolineatus 14 257 311 6
Myripristis berndti 30 147 279 24
Naso lituratus 17 228 432 10
Naso unicornis 4 488 613 17
Odonus niger 18 176 350 16
Ostorhinchus angustatus 15 46 83 6
Ostorhinchus apogonoides 30 52 96 7
Parupeneus barberinus 16 82 496 6
Plectropomus laevis 31 356 957 22
Pristiapogon taeniopterus 32 51 104 8
Sargocentron microstoma 23 62 204 13
Scarus psittacus 8 195 311 6
Siganus argenteus 11 236 388 13
Siganus spinus 4 199 254 3
Stegastes albifasciatus 7 43 94 8
Stegastes nigricans 14 45 138 13
Zebrasoma scopas 18 110 166 24

1.1.3 Individuals by location

data_complete %>%
  group_by(Species, Location) %>% 
  summarise(n = length(unique(ID))) %>% 
  pivot_wider(names_from = Location, values_from = n) %>% 
  mutate(Gambiers = cell_spec(Gambiers, "html", color = ifelse(is.na(Gambiers), "white", "#446CB3")),
         Hao = cell_spec(Hao, "html", color = ifelse(is.na(Hao), "white", "#446CB3")),
         Marquesas = cell_spec(Marquesas, "html", color = ifelse(is.na(Marquesas), "white", "#446CB3")),
         Moorea = cell_spec(Moorea, "html", color = ifelse(is.na(Moorea), "white", "#446CB3")),
         Manuae = cell_spec(Manuae, "html", color = ifelse(is.na(Manuae), "white", "#446CB3")),
         Tuamotu = cell_spec(Tuamotu, "html", color = ifelse(is.na(Tuamotu), "white", "#446CB3"))) %>% 
  kable(., 
        format = "html", escape = FALSE,
        caption = "Table 3. Number of individuals of each species by location") %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  column_spec(1, italic = T)
Table 3. Number of individuals of each species by location
Species Gambiers Moorea Manuae Marquesas Tuamotu Hao
Abudefduf sexfasciatus 11 5 NA NA NA NA
Acanthurus achilles 7 NA 10 NA NA NA
Acanthurus lineatus NA NA NA 8 NA NA
Acanthurus nigricans NA NA NA 8 NA NA
Acanthurus pyroferus NA NA NA 18 NA NA
Acanthurus triostegus 3 11 NA 4 NA NA
Balistapus undulatus NA 14 NA 8 NA NA
Caranx melampygus NA 5 NA NA 2 NA
Centropyge bispinosa NA 9 NA NA NA NA
Centropyge flavissima 9 7 NA 12 NA NA
Cephalopholis argus 6 10 NA NA 10 15
Cephalopholis urodeta 8 NA NA NA NA NA
Chaetodon citrinellus NA 13 NA NA NA NA
Chaetodon ornatissimus 4 NA NA 6 NA NA
Cheilinus chlorourus 2 6 NA NA NA NA
Chlorurus spilurus 13 19 NA NA 2 NA
Chromis iomelas NA 20 NA NA NA NA
Chromis viridis 6 NA NA NA NA NA
Ctenochaetus marginatus NA NA NA 15 NA NA
Ctenochaetus striatus 11 15 NA NA NA NA
Dascyllus aruanus NA 20 NA NA NA NA
Dascyllus flavicaudus 8 NA NA NA NA NA
Epibulus insidiator 12 5 NA NA NA NA
Epinephelus fasciatus NA NA NA 10 NA NA
Epinephelus hexagonatus NA NA NA NA NA 16
Epinephelus merra 13 20 NA NA NA 13
Epinephelus polyphekadion NA NA NA NA NA 14
Gnathodentex aureolineatus 8 NA NA NA NA NA
Gymnosarda unicolor 4 NA NA NA NA NA
Halichoeres trimaculatus 7 6 NA NA NA NA
Lutjanus fulvus NA 6 NA NA 6 NA
Lutjanus gibbus NA NA NA 17 NA NA
Lutjanus kasmira 2 NA NA 35 NA NA
Monotaxis grandoculis 5 3 NA NA 1 NA
Mulloidichthys flavolineatus NA 14 NA NA NA NA
Myripristis berndti 7 15 NA 8 NA NA
Naso lituratus 11 6 NA NA NA NA
Naso unicornis 4 NA NA NA NA NA
Odonus niger NA 13 NA 5 NA NA
Ostorhinchus angustatus NA 15 NA NA NA NA
Ostorhinchus apogonoides NA NA NA 30 NA NA
Parupeneus barberinus 5 4 NA 7 NA NA
Plectropomus laevis 12 NA NA NA NA 19
Pristiapogon taeniopterus NA NA NA 32 NA NA
Sargocentron microstoma NA 17 NA 6 NA NA
Scarus psittacus NA 3 NA NA 5 NA
Siganus argenteus 6 2 NA NA 3 NA
Siganus spinus NA 4 NA NA NA NA
Stegastes albifasciatus NA 7 NA NA NA NA
Stegastes nigricans 3 11 NA NA NA NA
Zebrasoma scopas 5 13 NA NA NA NA

1.1.4 Number of NA

# 1. Number of NA by variable

data_complete %>%
  summarise_all(~(sum(is.na(.)))) %>% 
  t(.) %>% 
  as.data.frame() %>% 
  kable(., col.names = c("NA"), caption = "Table 4. Number of rows with Non-Available (NA) data by variable") %>% 
  kable_styling(bootstrap_options = c("striped", "hover"))
Table 4. Number of rows with Non-Available (NA) data by variable
NA
Family 0
Genus 0
Species 0
ID 0
Agei 0
Ri 387
Agecpt 0
Rcpt 0
Lcpt 0
L0p 0
R0p 2811
Li_sp_m 410
Li_sp_sd 410
Li_sploc_m 757
Li_sploc_sd 757
Weight 603
Location 0
Observer 0

1.2 Plot

1.2.1 Agei vs Ri

ggplot(data_complete, aes(x = Agei, y = Ri)) +
  geom_point(color = col_color_graph, fill = col_fill_graph, size = 1, shape = 21)+
  theme(strip.text.x = element_text(size = 8, face = "italic"),
        strip.background = element_rect(colour = "black", fill = col_facet, size = 1),
        plot.title = element_text(colour = col_color_graph),
        plot.subtitle = element_text(colour = "black")) +
  facet_wrap(~Species, scales = "free", ncol = 5) +
  labs(x = "Age (years)", y = "Radius (mm)")
Figure 1. Relation between otolith radius (Ri) and age (Agei).

Figure 1. Relation between otolith radius (Ri) and age (Agei).

1.2.2 Agei vs Li (sp.)

ggplot(data_complete, aes(x = Agei, y = Li_sp_m)) +
  geom_point(color = col_color_graph, fill = col_fill_graph, size = 1, shape = 21)+
  theme(strip.text.x = element_text(size = 8),
        strip.background = element_rect(colour = "black", fill = col_facet, size = 1),
        plot.title = element_text(colour = col_color_graph),
        plot.subtitle = element_text(colour = "black"),
        strip.text.y = element_text(angle = 360, face = "italic")) +
  facet_wrap(~Species, scales = "free", ncol = 5) +
  labs(x = "Age (years)", y = "Length (mm)")
Figure 2. Relation between length (TL, mm) and age by species.

Figure 2. Relation between length (TL, mm) and age by species.

1.2.3 Agei vs Li (sp. and loc.)

ggplot(data_complete, aes(x = Agei, y = Li_sploc_m)) +
  geom_point(color = col_color_graph, fill = col_fill_graph, size = 1, shape = 21)+
  theme(strip.text.x = element_text(size = 8),
        strip.background = element_rect(colour = "black", fill = col_facet, size = 1),
        plot.title = element_text(colour = col_color_graph),
        plot.subtitle = element_text(colour = "black"),
        strip.text.y = element_text(angle = 360, face = "italic")) +
  facet_grid(Species~Location, scales = "free") +
  labs(x = "Age (years)", y = "Length (mm)")
Figure 3. Relation between length (TL, mm) and age by species and location.

Figure 3. Relation between length (TL, mm) and age by species and location.

2. VBGF results

2.1 Growth parameters

# 1. Growth parameters ----

read.csv("./../data/03_back-calculated_vbgf_predictions.csv") %>% 
  mutate(Estimate = paste0(round(Estimate, 3), " (", round(Est.Error, 3), ")")) %>% 
  pivot_wider(c("Species", Location), names_from = Parameter, values_from = Estimate) %>% 
  select(Species, Location, linf, k, t0) %>% 
  arrange(Species) %>% 
  kable(., 
        col.names = c("Species", "Location", "Linf", "K", "t0"), 
        caption = "Table 5. Values of Von Bertalanffy parameters estimated through Bayesian framework by species and location. Standard deviation are the values in parentheses. Linf is expressed in TL and cm.") %>% 
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  column_spec(1, italic = T)
Table 5. Values of Von Bertalanffy parameters estimated through Bayesian framework by species and location. Standard deviation are the values in parentheses. Linf is expressed in TL and cm.
Species Location Linf K t0
Abudefduf sexfasciatus Gambiers 14.756 (0.442) 0.933 (0.096) -0.036 (0.032)
Acanthurus achilles Manuae 19.203 (0.647) 0.986 (0.123) -0.039 (0.036)
Acanthurus lineatus Marquesas 29.874 (5.013) 0.326 (0.142) -0.471 (0.425)
Acanthurus nigricans Marquesas 16.976 (0.997) 1.139 (0.177) -0.02 (0.025)
Acanthurus pyroferus Marquesas 19.925 (1.267) 0.472 (0.09) -0.189 (0.139)
Acanthurus triostegus Moorea 15.704 (0.509) 0.628 (0.065) -0.096 (0.049)
Balistapus undulatus Marquesas 22.124 (3.352) 0.31 (0.161) -0.212 (0.144)
Balistapus undulatus Moorea 23.579 (7.632) 0.197 (0.08) -0.743 (0.571)
Caranx melampygus Moorea 92.984 (4.784) 0.085 (0.009) -0.585 (0.185)
Centropyge bispinosa Moorea 5.309 (0.889) 0.897 (0.866) -0.071 (0.037)
Centropyge flavissima Marquesas 7.356 (1.75) 0.905 (0.332) -0.049 (0.049)
Centropyge flavissima Moorea 8.197 (0.752) 1.199 (0.288) -0.03 (0.027)
Centropyge flavissima Gambiers 15.774 (3.627) 0.121 (0.067) -2.231 (1.364)
Cephalopholis argus Moorea 36.973 (8.569) 0.256 (0.109) -0.313 (0.291)
Cephalopholis argus Tuamotu 39.694 (7.17) 0.149 (0.077) -1.155 (0.719)
Cephalopholis argus Gambiers 42.924 (1.582) 0.2 (0.022) -0.655 (0.174)
Cephalopholis argus Hao 37.983 (5.701) 0.25 (0.051) -0.274 (0.072)
Cephalopholis urodeta Gambiers 20.459 (1.914) 0.152 (0.03) -0.626 (0.169)
Chaetodon ornatissimus Marquesas 11.167 (6.416) 1.308 (0.589) 0.311 (0.584)
Chlorurus spilurus Moorea 22.599 (1.415) 1.036 (0.187) -0.024 (0.042)
Chlorurus spilurus Gambiers 22.636 (1.175) 0.701 (0.097) -0.068 (0.046)
Chromis iomelas Moorea 5.066 (0.437) 1.145 (0.242) -0.06 (0.026)
Chromis viridis Gambiers 11.812 (1.153) 0.884 (0.25) -0.055 (0.06)
Ctenochaetus marginatus Marquesas 23.135 (2.877) 0.349 (0.082) -0.169 (0.077)
Ctenochaetus striatus Moorea 17.286 (0.565) 1.013 (0.087) -0.028 (0.02)
Ctenochaetus striatus Gambiers 17.078 (0.549) 0.501 (0.044) -0.141 (0.056)
Dascyllus aruanus Moorea 5.607 (0.212) 0.897 (0.096) -0.055 (0.028)
Dascyllus flavicaudus Gambiers 9.325 (0.632) 0.343 (0.042) -0.239 (0.076)
Epibulus insidiator Gambiers 26.751 (1.847) 0.306 (0.038) -0.257 (0.078)
Epinephelus fasciatus Marquesas 22.098 (1.801) 0.553 (0.077) -0.05 (0.036)
Epinephelus hexagonatus Hao 21.735 (1.043) 0.524 (0.06) -0.092 (0.052)
Epinephelus merra Moorea 14.308 (0.907) 1.126 (0.092) -0.017 (0.015)
Epinephelus merra Gambiers 18.697 (0.898) 0.598 (0.073) -0.11 (0.059)
Epinephelus merra Hao 22.536 (0.601) 0.794 (0.078) -0.05 (0.037)
Epinephelus polyphekadion Hao 55.015 (5.758) 0.153 (0.021) -0.412 (0.095)
Gnathodentex aureolineatus Gambiers 20.493 (0.992) 0.38 (0.056) -0.288 (0.119)
Halichoeres trimaculatus Gambiers 18.014 (1.691) 0.707 (0.148) -0.034 (0.054)
Lutjanus fulvus Moorea 19.088 (8.694) 8.277 (22.6) -0.073 (0.087)
Lutjanus fulvus Tuamotu 26.693 (2.498) 0.295 (0.057) -0.41 (0.178)
Mulloidichthys flavolineatus Moorea 25.687 (0.535) 1.274 (0.091) -0.013 (0.013)
Myripristis berndti Gambiers 24.025 (1.876) 0.272 (0.05) -0.524 (0.301)
Myripristis berndti Marquesas 21.911 (0.537) 0.328 (0.031) -0.355 (0.111)
Myripristis berndti Moorea 18.009 (0.964) 0.434 (0.051) -0.154 (0.054)
Naso lituratus Gambiers 31.949 (1.959) 1.24 (0.176) -0.01 (0.018)
Odonus niger Moorea 21.849 (6.476) 0.621 (0.8) -0.063 (0.105)
Ostorhinchus angustatus Moorea 7.405 (0.407) 0.602 (0.082) -0.125 (0.041)
Ostorhinchus apogonoides Marquesas 8.167 (0.211) 0.918 (0.057) -0.066 (0.012)
Plectropomus laevis Gambiers 93.868 (4.547) 0.143 (0.019) -0.65 (0.157)
Plectropomus laevis Hao 91.614 (5.686) 0.275 (0.031) -0.026 (0.026)
Pristiapogon taeniopterus Marquesas 7.992 (0.268) 0.849 (0.072) -0.083 (0.024)
Sargocentron microstoma Moorea 16.284 (0.556) 0.659 (0.053) -0.055 (0.028)
Siganus argenteus Gambiers 34.697 (4.895) 0.205 (0.06) -0.439 (0.257)
Stegastes nigricans Moorea 13.386 (2.113) 0.312 (0.153) -0.346 (0.204)

2.2 Growth curves

# 1. Growth curves ----

read.csv("./../data/03_back-calculated_vbgf_fitted.csv") %>% 
  ggplot(data = .) +
    geom_ribbon(aes(x = age, ymin = ypred_lq, ymax = ypred_uq, fill = Location), alpha = 0.5) +
    geom_line(aes(x = age, y = ypred_m, color = Location)) +
    geom_point(data = data_complete %>%
                 mutate(Li_sp_m = Li_sp_m/10), 
               aes(x = Agei, y = Li_sp_m, color = Location), size = 1) +
    facet_wrap(~Species, scales = "free", ncol = 5) +
    lims(y = c(0, NA)) +
    theme(strip.text.x = element_text(face = "italic")) +
    labs(x = "Age (years)", y = "Length (TL, cm)") +
    guides(colour = guide_legend(override.aes = list(alpha = 1, size = 0.5)))
Figure 4. Relation between length (TL, mm) and age by species and location.

Figure 4. Relation between length (TL, mm) and age by species and location.

3. Raw vs Back-calculation

3.1 Growth parameters

# 1. List of species with enough individuals for one location ----

species_list <- c("Abudefduf sexfasciatus", "Acanthurus achilles", "Acanthurus triostegus", 
                  "Chromis iomelas", "Dascyllus aruanus", "Ostorhinchus apogonoides", 
                  "Pristiapogon taeniopterus", "Stegastes nigricans")

# 1. Growth parameters ----

read.csv("./../data/03_raw_vbgf_predictions.csv") %>% 
  filter(Species %in% species_list) %>% 
  mutate(Value = paste0(round(Estimate, 3), " (", round(Est.Error, 3), ")")) %>% 
  select(Species, Location, Parameter, Value) %>% 
  pivot_wider(1:2, names_from = Parameter, values_from = Value) %>% 
  select(Species, Location, Linf, K, t0) %>% 
  arrange(Species) %>% 
  kable(., 
        col.names = c("Species", "Location", "Linf", "K", "t0"), 
        caption = "Table 5. Values of Von Bertalanffy parameters estimated through Bayesian framework by species and location. Standard deviation are the values in parentheses. Linf is expressed in TL and cm.") %>% 
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  column_spec(1, italic = T)
Table 5. Values of Von Bertalanffy parameters estimated through Bayesian framework by species and location. Standard deviation are the values in parentheses. Linf is expressed in TL and cm.
Species Location Linf K t0
Abudefduf sexfasciatus Gambiers 16.187 (0.28) 1.438 (0.279) -0.142 (0.241)
Acanthurus achilles Manuae 21.206 (0.687) 0.971 (0.273) -0.062 (0.26)
Acanthurus triostegus Moorea 17.384 (0.46) 0.881 (0.242) -0.054 (0.259)
Chromis iomelas Moorea 5.419 (0.282) 1.115 (0.251) -0.295 (0.153)
Dascyllus aruanus Moorea 6.241 (0.178) 0.935 (0.189) -0.076 (0.253)
Ostorhinchus apogonoides Marquesas 9.249 (0.284) 0.559 (0.07) -0.347 (0.12)
Pristiapogon taeniopterus Marquesas 9.053 (0.37) 0.625 (0.136) -0.261 (0.175)
Stegastes nigricans Moorea 13.884 (0.763) 0.34 (0.062) 0.077 (0.234)

3.2 Growth curves

# 1. Transform the data to get only Agecpt and Lcpt ----

data_raw <- read.csv("./../data/02_back-calculated-size-at-age_morat-et-al.csv") %>%
  filter(Species %in% species_list) %>% 
  select(Family, Genus, Species, ID, Agecpt, Lcpt, Location, Observer) %>% 
  unique() %>%
  dplyr::group_by(Species, Location) %>%
  dplyr::mutate(n = length(unique(ID))) %>%
  filter(n >= 10) %>% # filter with at least 10 replicates
  ungroup() %>% 
  dplyr::mutate(Lcpt = Lcpt/10) # Convert to cm

# 2. Make the plot ----

read.csv("./../data/03_raw_vbgf_fitted.csv") %>% 
  filter(Species %in% species_list) %>% 
  ggplot(data = .) +
    geom_ribbon(aes(x = Agei, ymin = Q2.5, ymax = Q97.5, fill = Location), alpha = 0.5) +
    geom_line(aes(x = Agei, y = Estimate, color = Location)) +
    geom_point(data = data_raw, aes(x = Agecpt, y = Lcpt, color = Location), size = 1) +
    facet_wrap(~Species, scales = "free", ncol = 4) +
    lims(y = c(0, NA)) +
    theme(strip.text.x = element_text(face = "italic")) +
    labs(x = "Age (years)", y = "Length (TL, cm)") +
    lims(y = c(0, NA), x = c(0, NA)) +
    guides(colour = guide_legend(override.aes = list(alpha = 1, size = 0.5)))

4. Comparison with literature

# 1. Import file synthesizing the VBGF parameters from literature ----

vbgf_literature <- read_excel("./../data/00_von-bertalanffy-literature.xlsx", sheet = 1) %>% 
  dplyr::mutate(Linf = ifelse(Size_unit == "mm", Linf/10, Linf),
                Size_max = ifelse(Size_unit == "mm", Size_max/10, Size_max)) %>% # Convert all length values to cm
  select(-Family, -Genus) # Remove Family and Genus to add those level through fishbase

# 2. Check validity of species names ----

vbgf_literature %>% 
  select(Species) %>% 
  unique() %>% 
  left_join(., load_taxa()) %>% 
  filter(is.na(Genus))
## # A tibble: 4 x 8
##   Species               SpecCode Genus Subfamily Family Order Class SuperClass
##   <chr>                    <dbl> <chr> <chr>     <chr>  <chr> <chr> <chr>     
## 1 Acanthurus chirugus         NA <NA>  <NA>      <NA>   <NA>  <NA>  <NA>      
## 2 Chlorurus microrbinos       NA <NA>  <NA>      <NA>   <NA>  <NA>  <NA>      
## 3 Scarus psitticus            NA <NA>  <NA>      <NA>   <NA>  <NA>  <NA>      
## 4 Cetoscarus bicolour         NA <NA>  <NA>      <NA>   <NA>  <NA>  <NA>
# 3. Apply the corrections and add Family and Genus ----

vbgf_literature <- vbgf_literature %>% 
  dplyr::mutate(Species = str_replace_all(Species, c("Acanthurus chirugus" = "Acanthurus chirurgus",
                                                     "Chlorurus microrbinos" = "Chlorurus microrhinos",
                                                     "Scarus psitticus" = "Scarus psittacus",
                                                     "Cetoscarus bicolour" = "Cetoscarus bicolor"))) %>% 
  left_join(., load_taxa() %>% 
                  select(Species, Genus, Family)) %>% 
  filter(Species %in% unique(data_complete$Species)) %>% 
  mutate(Reference = paste0(Reference, " (", Reference_type, ")")) %>%
  mutate_at(c("Linf", "K", "t0"), as.character) %>% 
  select(-Genus, -Family, -Size_unit, -Sex, -Reference_type) %>% 
  arrange(Species)

4.1 Growth parameters

# 1. Comparison of VBGF parameters between our study and literature ----

read.csv("./../data/03_back-calculated_vbgf_predictions.csv") %>% 
  mutate(Estimate = paste0(round(Estimate, 3), " (", round(Est.Error, 3), ")")) %>% 
  pivot_wider(c("Species", Location), names_from = Parameter, values_from = Estimate) %>% 
  select(Species, Location, linf, k, t0) %>% 
  rename(Linf = linf, K = k) %>% 
  mutate(Reference = "This study") %>% 
  full_join(., vbgf_literature) %>%
  select(Species, Location, Linf, K, t0, Reference) %>% 
  arrange(Species) %>% 
  kable(.,
        format = "html", escape = FALSE,
        col.names = c("Species", "Location", "Linf", "K", "t0", "Reference"), 
        caption = "Table 6. Comparison between .") %>% 
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  column_spec(1, italic = T)
Table 6. Comparison between .
Species Location Linf K t0 Reference
Abudefduf sexfasciatus Gambiers 14.756 (0.442) 0.933 (0.096) -0.036 (0.032) This study
Acanthurus achilles Manuae 19.203 (0.647) 0.986 (0.123) -0.039 (0.036) This study
Acanthurus lineatus Marquesas 29.874 (5.013) 0.326 (0.142) -0.471 (0.425) This study
Acanthurus lineatus NA 18.274 0.462 -0.32 Choat and Robertson, 2002 (Article)
Acanthurus lineatus Tutuila 22.1 0.12 -15.6 Craig et al, 1997 (Article)
Acanthurus lineatus Northern Great Barrier Reef 18.909 0.68 NA Gust et al, 2002 (Article)
Acanthurus lineatus Northern Great Barrier Reef 17.484 0.34 NA Gust et al, 2002 (Article)
Acanthurus lineatus Pago Pago, American Samoa 17 0.416 -0.329 Ralston and Williams, 1988 (Report)
Acanthurus nigricans Marquesas 16.976 (0.997) 1.139 (0.177) -0.02 (0.025) This study
Acanthurus nigricans NA 14.286 0.28 -0.69 Choat and Robertson, 2002 (Article)
Acanthurus pyroferus Marquesas 19.925 (1.267) 0.472 (0.09) -0.189 (0.139) This study
Acanthurus triostegus Moorea 15.704 (0.509) 0.628 (0.065) -0.096 (0.049) This study
Balistapus undulatus Marquesas 22.124 (3.352) 0.31 (0.161) -0.212 (0.144) This study
Balistapus undulatus Moorea 23.579 (7.632) 0.197 (0.08) -0.743 (0.571) This study
Caranx melampygus Moorea 92.984 (4.784) 0.085 (0.009) -0.585 (0.185) This study
Caranx melampygus Hawaiian islands 89.7 0.233 -0.044 Sudekum et al, 1991 (Article)
Centropyge bispinosa Moorea 5.309 (0.889) 0.897 (0.866) -0.071 (0.037) This study
Centropyge flavissima Marquesas 7.356 (1.75) 0.905 (0.332) -0.049 (0.049) This study
Centropyge flavissima Moorea 8.197 (0.752) 1.199 (0.288) -0.03 (0.027) This study
Centropyge flavissima Gambiers 15.774 (3.627) 0.121 (0.067) -2.231 (1.364) This study
Cephalopholis argus Moorea 36.973 (8.569) 0.256 (0.109) -0.313 (0.291) This study
Cephalopholis argus Tuamotu 39.694 (7.17) 0.149 (0.077) -1.155 (0.719) This study
Cephalopholis argus Gambiers 42.924 (1.582) 0.2 (0.022) -0.655 (0.174) This study
Cephalopholis argus Hao 37.983 (5.701) 0.25 (0.051) -0.274 (0.072) This study
Cephalopholis argus Hawaiian islands 50.6 0.075 -6.5 Donovan et al, 2013 (Article)
Cephalopholis argus Great Barrier Reef 48.5499 0.049 -14.145 Mapleston et al, 2009 (Report)
Cephalopholis argus Egypt, Red Sea 44.22 0.26 1.33 Mehanna et al, 2019 (Article)
Cephalopholis argus Great Barrier Reef 39.901 0.271 -0.169 Pears, 2005 (PhD Thesis)
Cephalopholis argus Seychelles 37.119 0.339 -0.147 Pears, 2005 (PhD Thesis)
Cephalopholis urodeta Gambiers 20.459 (1.914) 0.152 (0.03) -0.626 (0.169) This study
Cephalopholis urodeta Cocos Keeling and Christmas islands 20.645 0.31 NA Payet et al, 2016 (Article)
Cephalopholis urodeta Papua New Guinea 14.5 1.39 NA Fry et al, 2006 (Article)
Chaetodon citrinellus Lizard Island 9.07 2.15 -0.074 Berumen et al, 2005 (Article)
Chaetodon ornatissimus Marquesas 11.167 (6.416) 1.308 (0.589) 0.311 (0.584) This study
Chlorurus spilurus Moorea 22.599 (1.415) 1.036 (0.187) -0.024 (0.042) This study
Chlorurus spilurus Gambiers 22.636 (1.175) 0.701 (0.097) -0.068 (0.046) This study
Chlorurus spilurus Hawaiian islands 34.4 0.4 -0.13 DeMartini et al, 2017 (Article)
Chlorurus spilurus Guam and Ponhpei, Micronesia 21.8 0.95 -0.075 Taylor and Choat, 2014 (Article)
Chromis iomelas Moorea 5.066 (0.437) 1.145 (0.242) -0.06 (0.026) This study
Chromis viridis Gambiers 11.812 (1.153) 0.884 (0.25) -0.055 (0.06) This study
Ctenochaetus marginatus Marquesas 23.135 (2.877) 0.349 (0.082) -0.169 (0.077) This study
Ctenochaetus striatus Moorea 17.286 (0.565) 1.013 (0.087) -0.028 (0.02) This study
Ctenochaetus striatus Gambiers 17.078 (0.549) 0.501 (0.044) -0.141 (0.056) This study
Ctenochaetus striatus Tutuila 17.2 0.75 -0.4 Trip et al, 2008 (Article)
Ctenochaetus striatus Ta’u 18.2 0.5 -0.6 Trip et al, 2008 (Article)
Ctenochaetus striatus Ofu-Olosega 17.6 1.4 -0.2 Trip et al, 2008 (Article)
Ctenochaetus striatus Moorea 17.8 0.7 -0.4 Trip et al, 2008 (Article)
Ctenochaetus striatus Kavieng 15.9 0.5 -0.7 Trip et al, 2008 (Article)
Ctenochaetus striatus Kimbe Bay 12.8 0.6 -0.7 Trip et al, 2008 (Article)
Ctenochaetus striatus Lizard island 19.4 1 -0.3 Trip et al, 2008 (Article)
Ctenochaetus striatus Lizard island outer reef 17.1 0.9 -0.4 Trip et al, 2008 (Article)
Ctenochaetus striatus Townsville 20.1 0.8 -0.3 Trip et al, 2008 (Article)
Ctenochaetus striatus One Tree Island 19.9 0.3 -0.8 Trip et al, 2008 (Article)
Ctenochaetus striatus Oman 23.2 1.3 -0.2 Trip et al, 2008 (Article)
Ctenochaetus striatus Mahe Plateau, Seychelles 20.5 2.1 -0.1 Trip et al, 2008 (Article)
Ctenochaetus striatus Amirantes, Seychelles 18.5 1.1 -0.3 Trip et al, 2008 (Article)
Ctenochaetus striatus Cocos Keeling lagoon 18.8 0.4 -0.6 Trip et al, 2008 (Article)
Ctenochaetus striatus Cocos Keeling 19.4 0.4 -0.7 Trip et al, 2008 (Article)
Ctenochaetus striatus NA 16.8 0.591 -0.27 Choat and Robertson, 2002 (Article)
Ctenochaetus striatus Bani, Philippines 13.2 0.66 -0.16 Fidler et al, 2018 (Article)
Ctenochaetus striatus Bani, Philippines 11.9 0.72 -0.12 Fidler et al, 2018 (Article)
Ctenochaetus striatus San Salvador, Philippines 12.5 0.49 -0.36 Fidler et al, 2018 (Article)
Ctenochaetus striatus San Salvador, Philippines 11.9 0.72 -0.12 Fidler et al, 2018 (Article)
Ctenochaetus striatus Taklobo Farm, Philippines 12.6 0.69 -0.05 Fidler et al, 2018 (Article)
Ctenochaetus striatus Taklobo Farm, Philippines 11.9 0.72 -0.12 Fidler et al, 2018 (Article)
Ctenochaetus striatus Tutuila Island, American Samoa 17 0.9 0.2 Ochavillo et al, 2011 (Article)
Ctenochaetus striatus Pago Pago, American Samoa 25.6 0.424 -0.643 Ralston and Williams, 1988 (Report)
Dascyllus aruanus Moorea 5.607 (0.212) 0.897 (0.096) -0.055 (0.028) This study
Dascyllus flavicaudus Gambiers 9.325 (0.632) 0.343 (0.042) -0.239 (0.076) This study
Epibulus insidiator Gambiers 26.751 (1.847) 0.306 (0.038) -0.257 (0.078) This study
Epibulus insidiator Palm Islands, Great Barrier Reef 19.894 0.25 -0.172 Hubble, 2003 (PhD Thesis)
Epinephelus fasciatus Marquesas 22.098 (1.801) 0.553 (0.077) -0.05 (0.036) This study
Epinephelus fasciatus Great Barrier Reef 28.1814 0.405 -0.685 Mapleston et al, 2009 (Report)
Epinephelus fasciatus Great Barrier Reef 28.213 0.469 -0.198 Pears, 2005 (PhD Thesis)
Epinephelus fasciatus Seychelles 27.46 0.45 -0.212 Pears, 2005 (PhD Thesis)
Epinephelus hexagonatus Hao 21.735 (1.043) 0.524 (0.06) -0.092 (0.052) This study
Epinephelus merra Moorea 14.308 (0.907) 1.126 (0.092) -0.017 (0.015) This study
Epinephelus merra Gambiers 18.697 (0.898) 0.598 (0.073) -0.11 (0.059) This study
Epinephelus merra Hao 22.536 (0.601) 0.794 (0.078) -0.05 (0.037) This study
Epinephelus merra Reunion island 21.2 0.5 -0.009 Pothin et al, 2004 (Article)
Epinephelus polyphekadion Hao 55.015 (5.758) 0.153 (0.021) -0.412 (0.095) This study
Epinephelus polyphekadion Pohnpei 44.71 0.251 -0.14 Rhodes et al, 2011 (Article)
Epinephelus polyphekadion Aldabra island 57.9 0.18 0 Grandcourt, 2005 (Article)
Epinephelus polyphekadion Yaeyama islands 56.58 0.139 -1.18 Ohta et al, 2017 (Article)
Epinephelus polyphekadion Great Barrier Reef 56.2345 0.194 -0.081 Mapleston et al, 2009 (Report)
Epinephelus polyphekadion Great Barrier Reef 53.701 0.195 -0.245 Pears, 2005 (PhD Thesis)
Epinephelus polyphekadion Seychelles 58.237 0.206 -0.212 Pears, 2005 (PhD Thesis)
Gnathodentex aureolineatus Gambiers 20.493 (0.992) 0.38 (0.056) -0.288 (0.119) This study
Halichoeres trimaculatus Gambiers 18.014 (1.691) 0.707 (0.148) -0.034 (0.054) This study
Lutjanus fulvus Moorea 19.088 (8.694) 8.277 (22.6) -0.073 (0.087) This study
Lutjanus fulvus Tuamotu 26.693 (2.498) 0.295 (0.057) -0.41 (0.178) This study
Lutjanus fulvus Yaeyama islands 26.5 0.41 -0.49 Shimose and Nanami, 2014 (Article)
Lutjanus gibbus New Caledonia 35.13 0.29 -1 Moore, 2019 (Article)
Lutjanus gibbus Ishigaki islands 39.05 0.21 -1.88 Nanami et al, 2010 (Article)
Lutjanus gibbus Ishigaki islands 30.34 0.256 -3.05 Nanami et al, 2010 (Article)
Lutjanus gibbus Great Barrier Reef 54.4 0.06 -9.48 Heupel et al, 2010b (Article)
Lutjanus gibbus Great Barrier Reef 35.2 0.51 NA Currey et al, 2010 (Report)
Lutjanus gibbus Indonesia 27.4 0.78 -0.24 Holloway et al, 2015 (Article)
Lutjanus kasmira Hawaiian islands 34 0.29 -1.37 Morales-Nin and Ralston, 1990 (Article)
Lutjanus kasmira Pago Pago, American Samoa 29.6 0.384 -1.349 Ralston and Williams, 1988 (Report)
Mulloidichthys flavolineatus Moorea 25.687 (0.535) 1.274 (0.091) -0.013 (0.013) This study
Mulloidichthys flavolineatus Hurghada 38 0.27 -1.15 Mehanna et al, 2017 (Article)
Myripristis berndti Gambiers 24.025 (1.876) 0.272 (0.05) -0.524 (0.301) This study
Myripristis berndti Marquesas 21.911 (0.537) 0.328 (0.031) -0.355 (0.111) This study
Myripristis berndti Moorea 18.009 (0.964) 0.434 (0.051) -0.154 (0.054) This study
Naso lituratus Gambiers 31.949 (1.959) 1.24 (0.176) -0.01 (0.018) This study
Naso lituratus Pohnpei 21.2 1.38 -0.2 Taylor et al, 2014 (Article)
Naso lituratus Guam 20.4 0.93 -0.3 Taylor et al, 2014 (Article)
Naso unicornis Hawaiian islands 47.8 0.44 -0.12 Andrews et al, 2016 (Article)
Naso unicornis Pohnpei 47.1 0.36 -0.14 Taylor et al, 2014 (Article)
Naso unicornis Guam 49.3 0.22 -0.48 Taylor et al, 2014 (Article)
Naso unicornis NA 38.577 0.489 -0.14 Choat and Robertson, 2002 (Article)
Odonus niger Moorea 21.849 (6.476) 0.621 (0.8) -0.063 (0.105) This study
Ostorhinchus angustatus Moorea 7.405 (0.407) 0.602 (0.082) -0.125 (0.041) This study
Ostorhinchus apogonoides Marquesas 8.167 (0.211) 0.918 (0.057) -0.066 (0.012) This study
Plectropomus laevis Gambiers 93.868 (4.547) 0.143 (0.019) -0.65 (0.157) This study
Plectropomus laevis Hao 91.614 (5.686) 0.275 (0.031) -0.026 (0.026) This study
Plectropomus laevis Aldabra island 101.5 0.19 0 Grandcourt, 2005 (Article)
Plectropomus laevis Great Barrier Reef 115.9 0.096 -2.28 Heupel et al, 2010a (Article)
Pristiapogon taeniopterus Marquesas 7.992 (0.268) 0.849 (0.072) -0.083 (0.024) This study
Sargocentron microstoma Moorea 16.284 (0.556) 0.659 (0.053) -0.055 (0.028) This study
Scarus psittacus NA 17.21 1.19 -0.05 Choat and Robertson, 2002 (Article)
Scarus psittacus Hawaiian islands 32.7 0.486 -0.01 DeMartini et al, 2017 (Article)
Scarus psittacus Tutuila Island, American Samoa 21.7 1.653 -0.29 Page, 1998 (Report)
Scarus psittacus Guam and Ponhpei, Micronesia 20.7 0.91 -0.083 Taylor and Choat, 2014 (Article)
Siganus argenteus Gambiers 34.697 (4.895) 0.205 (0.06) -0.439 (0.257) This study
Siganus argenteus Mariana islands 27.4 0.9 -0.3 Taylor et al, 2016 (Article)
Stegastes nigricans Moorea 13.386 (2.113) 0.312 (0.153) -0.346 (0.204) This study
Zebrasoma scopas NA 13.282 0.425 -0.49 Choat and Robertson, 2002 (Article)

4.2 Growth curves

# 1. Get predictions from literature data ----

vbgf_literature_pred <- vbgf_literature %>% 
  # Complete missing Age_max
  filter(is.na(Age_max)) %>% 
  left_join(., vbgf_literature %>% 
              group_by(Species) %>% 
              summarise(Age_max2 = max(Age_max, na.rm = TRUE)) %>% 
              mutate(Age_max2 = na_if(Age_max2, -Inf))) %>% 
  mutate(Age_max = ifelse(is.na(Age_max), Age_max2, Age_max)) %>% 
  select(-Age_max2) %>% 
  bind_rows(., vbgf_literature %>% 
              filter(!(is.na(Age_max)))) %>% 
  arrange(Species) %>% 
  # Fix missing t0 to 0
  dplyr::mutate(t0 = ifelse(is.na(t0), 0, t0)) %>% 
  filter(!(is.na(K)), !(is.na(Linf)), !(is.na(t0))) %>% 
  mutate_at(c("Linf", "K", "t0"), as.numeric) %>% 
  filter(Species %in% unique(read.csv("./../data/03_back-calculated_vbgf_fitted.csv")$Species)) %>% 
  # Make the predictions
  dplyr::mutate(Line = row_number()) %>% 
  group_by(Line) %>% 
  do(pred_vbgf(data = .))

# 2. Make the plot ----

plot_final <- read.csv("./../data/03_back-calculated_vbgf_fitted.csv") %>% 
  filter(Species %in% unique(vbgf_literature_pred$Species)) %>% 
  ggplot(data = .) +
  geom_ribbon(aes(x = age, ymin = ypred_lq, ymax = ypred_uq, group = Location, fill = Location), alpha = 0.5) +
  geom_line(aes(x = age, y = ypred_m, color = Location), size = 0.7) +
  geom_line(data = vbgf_literature_pred, aes(x = Agei, y = Li, group = as.factor(Line), text = Reference), size = 0.7) +
  facet_wrap(~Species, ncol = 4, scales = "free") +
  labs(x = "Age (years)", y = "Length (cm)") +
  theme(strip.text.x = element_text(face = "italic")) +
  lims(y = c(0, NA), x = c(0, NA)) +
  guides(colour = guide_legend(override.aes = list(alpha = 1, size = 0.5)))

plot_final

# 4. Convert to plotly ----

ggplotly(plot_final)

4.3 Maximum age

# 1. Comparison of the maximum age between our study and literature ----

vbgf_literature %>% 
  filter(!(is.na(Age_max))) %>% 
  group_by(Species) %>% 
  summarise(Age_max = max(Age_max)) %>% 
  ungroup() %>% 
  left_join(., vbgf_literature) %>% 
  select(Species, Age_max, Reference) %>% 
  right_join(., data_complete %>% 
                  mutate(Lcpt = Lcpt/10) %>% 
                  filter(!(is.na(Agecpt))) %>% 
                  group_by(Species) %>% 
                  summarise(Agecpt = max(Agecpt)) %>% 
                  ungroup()) %>% 
  select(Species, Agecpt, Age_max, Reference) %>% 
  arrange(Species) %>%
  mutate(Agecpt = as.numeric(as.character(Agecpt)),
         Age_max = as.numeric(as.character(Age_max))) %>% 
  mutate(Species = cell_spec(Species, "html", color = "black"),
         Agecpt = cell_spec(Agecpt, "html", color = "black"),
         Age_max = cell_spec(Age_max, "html", color = ifelse(is.na(Age_max), "white", "black")),
         Reference = cell_spec(Reference, "html", color = ifelse(is.na(Reference), "white", "black"))) %>% 
  kable(., 
        format = "html", escape = FALSE,
        col.names = c("Species", "Age max.", "Age max.", "Reference"),
        caption = "Table 4. Comparison of maximum age (Age max.) between this study and litterature. When value of Age max. from literature is missing for one species, it can be either due to unspecified maximum age in the reference or absent value in literature for the considered species.") %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>% 
  column_spec(1, italic = T) %>%
  add_header_above(c(" " = 1, "This Study" = 1, "Litterature" = 2))
Table 4. Comparison of maximum age (Age max.) between this study and litterature. When value of Age max. from literature is missing for one species, it can be either due to unspecified maximum age in the reference or absent value in literature for the considered species.
This Study
Litterature
Species Age max. Age max. Reference
Abudefduf sexfasciatus 13 NA NA
Acanthurus achilles 27 NA NA
Acanthurus lineatus 23 42 Gust et al, 2002 (Article)
Acanthurus nigricans 9 NA NA
Acanthurus pyroferus 19 NA NA
Acanthurus triostegus 12 NA NA
Balistapus undulatus 18 NA NA
Caranx melampygus 15 6 Sudekum et al, 1991 (Article)
Centropyge bispinosa 11 NA NA
Centropyge flavissima 27 NA NA
Cephalopholis argus 21 39 Mapleston et al, 2009 (Report)
Cephalopholis urodeta 17 12 Payet et al, 2016 (Article)
Chaetodon citrinellus 6 7 Berumen et al, 2005 (Article)
Chaetodon ornatissimus 10 NA NA
Cheilinus chlorourus 6 NA NA
Chlorurus spilurus 16 11 DeMartini et al, 2017 (Article)
Chromis iomelas 5 NA NA
Chromis viridis 9 NA NA
Ctenochaetus marginatus 13 NA NA
Ctenochaetus striatus 17 37 Trip et al, 2008 (Article)
Dascyllus aruanus 7 NA NA
Dascyllus flavicaudus 13 NA NA
Epibulus insidiator 16 16 Hubble, 2003 (PhD Thesis)
Epinephelus fasciatus 13 21 Mapleston et al, 2009 (Report)
Epinephelus hexagonatus 14 NA NA
Epinephelus merra 17 6 Pothin et al, 2004 (Article)
Epinephelus polyphekadion 20 44 Mapleston et al, 2009 (Report)
Gnathodentex aureolineatus 17 NA NA
Gymnosarda unicolor 7 NA NA
Halichoeres trimaculatus 5 NA NA
Lutjanus fulvus 21 34 Shimose and Nanami, 2014 (Article)
Lutjanus gibbus 1 38 Moore, 2019 (Article)
Lutjanus kasmira 30 NA NA
Monotaxis grandoculis 20 NA NA
Mulloidichthys flavolineatus 6 6 Mehanna et al, 2017 (Article)
Myripristis berndti 24 NA NA
Naso lituratus 10 14 Taylor et al, 2014 (Article)
Naso unicornis 17 50 Andrews et al, 2016 (Article)
Odonus niger 16 NA NA
Ostorhinchus angustatus 6 NA NA
Ostorhinchus apogonoides 7 NA NA
Parupeneus barberinus 6 NA NA
Plectropomus laevis 22 16 Heupel et al, 2010a (Article)
Pristiapogon taeniopterus 8 NA NA
Sargocentron microstoma 13 NA NA
Scarus psittacus 6 6 DeMartini et al, 2017 (Article)
Scarus psittacus 6 6 Taylor and Choat, 2014 (Article)
Siganus argenteus 13 NA NA
Siganus spinus 3 NA NA
Stegastes albifasciatus 8 NA NA
Stegastes nigricans 13 NA NA
Zebrasoma scopas 24 NA NA

5. Annex

# 1. Variables description ----

data.frame(Column = 1:ncol(data_complete),
           Variable = colnames(data_complete),
           Description = NA,
           Unit = NA,
           Type = str_to_title(as.vector(sapply(data_complete, class)))) %>% 
  left_join(., data_complete %>% 
              mutate_if(is.character, ~NA) %>% 
              summarise_all(., ~paste0(round(min(., na.rm = TRUE), 3), " - ", round(max(., na.rm = TRUE), 3))) %>% 
              pivot_longer(everything(), names_to = "Variable", values_to = "Range") %>% 
              mutate(Range = na_if(Range, "Inf - -Inf"))) %>% 
  write.csv2(., "./../doc/03_resubmission_scientific-data/variables_description.csv", row.names = FALSE)
# 1. Extract the characteristics of individual used as otoliths section examples ----

sections_example <- data_complete %>% 
  filter(ID %in% c("GAM18_B006", "AC_LI_MA_03_17_221", "AC_NI_MA_03_17_118", "AC_PY_MA_03_17_009", "MOO18FE167",
                   "GAM18_B112", "CT_MA_MA_03_17_396", "GAM18_A033", "GAM18_A059", "GAM18_B080", # Acanthuridae
                   "OS_AP_MA_03_17_284", "PR_TA_MA_03_17_101", # Apogonidae
                   "OD_NI_MA_03_17_045", "BA_UN_MO_03_16_003", # Balistidae
                   "GAM18_A100", # Chaetodontidae
                   "GAM18_A156", "SA_MI_MA_03_17_128", # Holocentridae
                   "GAM18_B066", "GAM18_A011", "GAM18_A214", # Labridae
                   "GAM18_B105", "GAM18_B093", # Lethrinidae
                   "LU_GI_MA_03_17_058", "GAM18_B099", # Lutjanidae
                   "GAM18_B129", # Mullidae
                   "GAM18_A135", "CE_BI_MO_03_16_002", "GAM18_B056", "GAM18_A162", "DA_AR_MO_03_16_011",
                   "GAM18_A036", "GAM18_A191", "CH_JO_MO_03_16_013", # Pomacentridae
                   "GAM18_A120", "SC_PS_TA_03_16_019", # Scaridae
                   "GAM18_B012", # Scombridae
                   "GAM18_A073", "GAM18_A089", "EP_FA_MA_03_17_027", "H33", "GAM18_A154", "H70", "GAM18_B052", # Serranidae
                   "GAM18_B019", "SI_SP_MO_03_16_008")) %>% # Siganidae
  filter(Agei == 0) %>% 
  select(Family, Species, ID, Agecpt, Lcpt, Location) %>% 
  arrange(Family, Species) %>% 
  mutate(Legend = paste0(row_number(), ". ", Species, " (", Agecpt, " years, ", Lcpt, " mm TL)"))

# 2. Export the txt file needed for the legend of the figure on otoliths sections ----

write.table(paste(sections_example$Legend, collapse = ", "), 
            "./../doc/03_resubmission_scientific-data/legend_fig_otolith_sections.txt", 
            col.names = FALSE, row.names = FALSE)

Reproducibility

# 1. Reproducibility ----

sessionInfo()
## R version 4.0.1 (2020-06-06)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 18363)
## 
## Matrix products: default
## 
## locale:
## [1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252   
## [3] LC_MONETARY=French_France.1252 LC_NUMERIC=C                  
## [5] LC_TIME=French_France.1252    
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] rfishbase_3.0.4     plotly_4.9.2.1      readxl_1.3.1       
##  [4] formattable_0.2.0.1 kableExtra_1.1.0    forcats_0.5.0      
##  [7] stringr_1.4.0       dplyr_1.0.0         purrr_0.3.4        
## [10] readr_1.3.1         tidyr_1.1.0         tibble_3.0.1       
## [13] ggplot2_3.3.2       tidyverse_1.3.0     RColorBrewer_1.1-2 
## [16] extrafont_0.17     
## 
## loaded via a namespace (and not attached):
##  [1] httr_1.4.1        jsonlite_1.6.1    viridisLite_0.3.0 modelr_0.1.8     
##  [5] assertthat_0.2.1  highr_0.8         blob_1.2.1        cellranger_1.1.0 
##  [9] yaml_2.2.1        Rttf2pt1_1.3.8    pillar_1.4.4      backports_1.1.7  
## [13] lattice_0.20-41   glue_1.4.1        extrafontdb_1.0   digest_0.6.25    
## [17] rvest_0.3.5       colorspace_1.4-1  htmltools_0.5.0   pkgconfig_2.0.3  
## [21] broom_0.5.6       haven_2.3.1       scales_1.1.1      webshot_0.5.2    
## [25] generics_0.0.2    farver_2.0.3      ellipsis_0.3.1    withr_2.2.0      
## [29] lazyeval_0.2.2    cli_2.0.2         magrittr_1.5      crayon_1.3.4     
## [33] memoise_1.1.0     evaluate_0.14     fs_1.4.1          fansi_0.4.1      
## [37] nlme_3.1-148      xml2_1.3.2        tools_4.0.1       gh_1.1.0         
## [41] data.table_1.12.8 hms_0.5.3         lifecycle_0.2.0   munsell_0.5.0    
## [45] reprex_0.3.0      compiler_4.0.1    rlang_0.4.6       grid_4.0.1       
## [49] rstudioapi_0.11   htmlwidgets_1.5.1 crosstalk_1.1.0.1 labeling_0.3     
## [53] rmarkdown_2.3     gtable_0.3.0      DBI_1.1.0         curl_4.3         
## [57] R6_2.4.1          lubridate_1.7.9   knitr_1.28        utf8_1.1.4       
## [61] stringi_1.4.6     Rcpp_1.0.4.6      vctrs_0.3.1       dbplyr_1.4.4     
## [65] tidyselect_1.1.0  xfun_0.14

Jeremy WICQUART | | 2020-07-15 09:30:21